//
//  RHDevEMSModel.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2024/3/1.
//

#import "RHDevEMSModel.h"
#import "RHDevDataModel.h"

@implementation RHDevEMSModel
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper
{
    return @{@"infoArr":@"rows"};
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    
  return @{@"infoArr" : [RHDevDataModel class]};
    
 }

-(void)setData:(NSDictionary *)data
{
    _data = data;
    if(data){
        [_infoArr enumerateObjectsUsingBlock:^(RHDevDataModel  *_Nonnull dataModel, NSUInteger idx, BOOL * _Nonnull stop) {
            NSString *value = ValidNullData(data[dataModel.keyCode]);
            if(value.length > 0){
                if([data[dataModel.keyCode] isKindOfClass:[NSString class]]){
                    dataModel.content = data[dataModel.keyCode];
                }else{
                    dataModel.content = [NSString stringWithFormat:@"%ld",[data[dataModel.keyCode] integerValue]];
                }
            }else{
                if(dataModel.content.length == 0){
                    dataModel.content = @"--";
                }
                
            }
        }];
    }

}
@end
